home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
tools
/
czesc_4
/
smallmath
/
source
/
spow.a
< prev
next >
Wrap
Text File
|
1993-01-24
|
2KB
|
144 lines
XDEF _IEEESPPow
SECTION code
_IEEESPPow:
fmove.s d1,fp1
fmove.s d0,fp0
ftst.x fp0
fbogt.w ArgPositive
fbeq.w ArgEQZero
ArgNegative:
fmove.x fp3,-(sp)
fint.x fp1,fp3
fcmp.x fp1,fp3
fbne.w ReturnNotANumber
NegativeToIntOrInf:
ftst.x fp1
fmovem.l fpsr,d0
btst.l #25,d0
bne.w ReturnNotANumber
NegativeToInteger:
fmove.x fp2,-(sp)
fscale.w #-1,fp3
fint.x fp3,fp2
fcmp.x fp3,fp2
fbeq.w NegativeToEven
NegativeToOdd:
fmovem.x (sp)+,fp2/fp3
fabs.x fp0
flogn.x fp0
fmul.x fp0,fp1
fetox.x fp1
fmove.s fp1,d0
bset.l #31,d0
rts
NegativeToEven:
fmovem.x (sp)+,fp2/fp3
fabs.x fp0
flogn.x fp0
fmul.x fp0,fp1
fetox.x fp1
fmove.s fp1,d0
rts
ArgPositive:
flogn.x fp0
fmul.x fp0,fp1
fetox.x fp1
fmove.s fp1,d0
rts
ArgEQZero:
ftst.x fp1
ZeroToZero:
fbeq.w ReturnNotANumberNoFP2
ZeroToNonZero:
fmovem.l fpsr,d0
btst.l #25,d0
bne.w ZeroToInfinity
ZeroToReal:
ftst.x fp0
fmovem.l fpsr,d0
btst.l #27,d0
beq.w PositiveZeroToReal
NegativeZeroToReal:
fmove.x fp3,-(sp)
fint.x fp1,fp3
fcmp.x fp1,fp3
fbne.w ReturnNotANumber
NegativeZeroToInteger:
ftst.x fp1
fmovem.l fpsr,d0
btst.l #25,d0
bne.w ReturnNotANumber
fmove.x fp2,-(sp)
fscale.w #-1,fp3
fint.x fp3,fp2
fcmp.x fp3,fp2
fbeq.w NegativeZeroToEven
NegativeZeroToOdd:
fmovem.x (sp)+,fp2/fp3
ftst.x fp1
fbogt.w NegativeZeroToPositiveOdd
NegativeZeroToNegativeOdd:
move.l #$FF800000,d0
rts
NegativeZeroToPositiveOdd:
move.l #$80000000,d0
rts
NegativeZeroToEven:
fmovem.x (sp)+,fp2/fp3
ftst.x fp1
fbogt.w NegativeZeroToPositiveEven
NegativeZeroToNegativeEven:
move.l #$7F800000,d0
rts
NegativeZeroToPositiveEven:
clr.l d0
rts
PositiveZeroToReal:
ftst.x fp1
fbogt.w PositiveZeroToPositiveReal
PositiveZeroToNegativeReal:
move.l #$7F800000,d0
rts
PositiveZeroToPositiveReal:
clr.l d0
rts
ZeroToInfinity:
btst.l #27,d0
beq.w ZeroToPositiveInfinity
ZeroToNegativeInfinity:
ftst.x fp0
fmovem.l fpsr,d0
btst.l #27,d0
beq.w PositiveZeroToNegativeInfinity
NegativeZeroToNegativeInfinity:
bra.w ReturnNotANumberNoFP2
PositiveZeroToNegativeInfinity:
move.l #$7F800000,d0
rts
ZeroToPositiveInfinity:
ftst.x fp0
fmovem.l fpsr,d0
btst.l #27,d0
beq.w PositiveZeroToPositiveInfinity
NegativeZeroToPositiveInfinity:
bra.w ReturnNotANumberNoFP2
PositiveZeroToPositiveInfinity:
clr.l d0
rts
ReturnNotANumber:
fmove.x (sp)+,fp3
ReturnNotANumberNoFP2:
move.l #$7FFFFFFF,d0
rts
END